
//缩放效果

import 'package:flutter/material.dart';

class CustomRouteZoom extends PageRouteBuilder{
  final Widget widget;
  CustomRouteZoom(this.widget)
    :super(
      transitionDuration:const Duration(seconds:1),
      pageBuilder:(
        BuildContext context,
        Animation<double> animation1,
        Animation<double> animation2){
          return widget;
        },
     transitionsBuilder:(
          BuildContext context,
          Animation<double> animation1,
          Animation<double> animation2,
          Widget child){
            //缩放
            return ScaleTransition(
              scale:Tween(begin:0.0,end:1.0).animate(CurvedAnimation(
                  parent:animation1,
                  curve: Curves.fastOutSlowIn
                  )),
              child:child
            );

          //渐变
        //     return FadeTransition(
        //   // 从0开始到1
        //   opacity: Tween(begin: 0.0,end: 1.0)
        //   .animate(CurvedAnimation(
        //     // 传入设置的动画
        //     parent: animation1,
        //     // 设置效果，快进漫出   这里有很多内置的效果
        //     curve: Curves.fastOutSlowIn,
        //   )),
        //   child: child,
        // );
            
        }  
    ); 
}